Skip to content

Improved mouse support #1481

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 12, 2021
Merged

Improved mouse support #1481

merged 2 commits into from
Oct 12, 2021

Conversation

jonathanslenders
Copy link
Member

@jonathanslenders jonathanslenders commented Aug 19, 2021

Added more mouse support functionality, including the ability to discriminate
which mouse button was pressed as well as reporting click-drags, and mouse
movements when no mouse button is pressed. Also improved mouse support while
text editing: when you click and drag, your selection will be shown in realtime
(as opposed to having to release the mouse press to see the resulting
selection).

To see this functionality in action, try running
examples/full-screen/text-editor.py, write some text, then click and drag over
that text to select it.

Original pull request: #1387
This PR takes the same changes, rebased on "master" + adds a few fixes related to Windows.

TODO:

  • Handle modifiers on Windows.

@jonathanslenders jonathanslenders force-pushed the better-mouse-support branch 3 times, most recently from fffbd83 to 5daaafb Compare August 19, 2021 15:38
Comment on lines +126 to +138
(35, 'M') : (NO_BUTTON, MOUSE_MOVE, NO_MODIFIER), # none_drag 35+ + + =35
(39, 'M') : (NO_BUTTON, MOUSE_MOVE, SHIFT), # none_drag Shift 35+4+ + =39
(43, 'M') : (NO_BUTTON, MOUSE_MOVE, ALT), # none_drag Alt 35+ +8+ =43
(47, 'M') : (NO_BUTTON, MOUSE_MOVE, SHIFT_ALT), # none_drag Shift Alt 35+4+8+ =47
(51, 'M') : (NO_BUTTON, MOUSE_MOVE, CONTROL), # none_drag Control 35+ + +16=51
(55, 'M') : (NO_BUTTON, MOUSE_MOVE, SHIFT_CONTROL), # none_drag Shift Control 35+4+ +16=55
(59, 'M') : (NO_BUTTON, MOUSE_MOVE, ALT_CONTROL), # none_drag Alt Control 35+ +8+16=59
(63, 'M') : (NO_BUTTON, MOUSE_MOVE, SHIFT_ALT_CONTROL), # none_drag Shift Alt Control 35+4+8+16=63

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No button mouse movement is lowercase m on WSL. I'm not sure if it's a bug here or with windows.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, indeed. Possibly it's the Windows terminal.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's odd...is there a way to detect that? Or we could just detect both M and m

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could just duplicate this block with a lowercase m for WSL if that's something you want to support.

SqrtRyan and others added 2 commits August 20, 2021 12:27
Added more mouse support functionality, including the ability to discriminate
which mouse button was pressed as well as reporting click-drags, and mouse
movements when no mouse button is pressed. Also improved mouse support while
text editing: when you click and drag, your selection will be shown in realtime
(as opposed to having to release the mouse press to see the resulting
selection).

To see this functionality in action, try running
examples/full-screen/text-editor.py, write some text, then click and drag over
that text to select it.

Commit co-authored by: Jonathan Slenders
@AnthonyDiGirolamo
Copy link

This is great! Is there anything I can help with to get this merged?

@jonathanslenders
Copy link
Member Author

@AnthonyDiGirolamo, I'm probably going to merge this. What needs to be done is the handling of all modifiers on Windows systems, but I don't have time to work on that right now.

@jonathanslenders jonathanslenders merged commit 46d0f1d into master Oct 12, 2021
@jonathanslenders jonathanslenders deleted the better-mouse-support branch October 12, 2021 20:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants